<!DOCTYPE HTML>
<html lang="en">
<head>
  <meta name="copyright" content=
  "Copyright (c) IBM Corporation and others 2000, 2011. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page.">
  <meta charset="utf-8">
  <link rel="STYLESHEET" href="../book.css" type="text/css">
  <title>Version Control Life Cycle: Adding and Ignoring Resources</title>
  <meta name="keyword" content="team">
  <script language="JavaScript" src="PLUGINS_ROOT/org.eclipse.help/livehelp.js" type="text/javascript"></script>
</head>
<body>
  <h1 class="Head">Version Control Life Cycle: Adding and Ignoring Resources</h1>
  <p>When committing resources, often there are resources that you do not want to store in the repository. For example,
  external editors might create temporary files in your project, compilation of .java files might create .class files,
  or some build operations might result in binary files. When put together, these generated files may be quite large.
  They may also be regenerated whenever a build is performed, resulting in many outgoing changes. Typically these are
  not files that one wants to persist in the repository or to share with other members of a team.</p>
  <p>Team has two related tasks that allow you to control which files are stored in the repository: adding a
  resource to version control, and ignoring a resource.</p>
  <h2>Adding a File to Version Control</h2>
  <p>Team does not automatically add files to version control. Rather, it's your choice to explicitly add files to
  version control. This is accomplished by selecting the <b>Team &gt; Add to Version Control</b> menu.</p>
  <p>When performed on a file, it will add that file to version control. The result is that the VCS repository
  immediately creates an entry so that it can start maintaining history state for that file. This occurs even before
  you commit the file to the repository.</p>
  <p>When adding a folder or project, the action will recursively descend into sub-folders, adding those files it finds
  to version control, provided the files have not been explicitly ignored.</p>
  <p><em>Tip:</em> When committing files, if the selection either directly or recursively contains files which have not
  been added to version control, you will be prompted whether or not you want them added. This is a convenience
  function to help ensure that you do not miss committing new resources which were unintentionally never added.</p>
  <h2><i>How May I Ignore Thee, Let Me Count the Ways</i></h2>
  <p>There are several facilities that allow you to specify which resources should be excluded from version
  control:</p>
  <ol>
    <li>There is a global preference which you can use for ignoring files and directories that match a certain filename
    pattern. For example, if you create a global ignore for <samp>/bin</samp>, and any resource that matches "bin" in
    any directory in the workspace will be ignored for version control. Use the <a class="command-link" href=
    'javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.team.ui.IgnorePreferences)")'>
    <img src="PLUGINS_ROOT/org.eclipse.help/command_link.svg" alt="command link"> <b>Team &gt; Ignored
    Resources</b></a> preference page to globally exclude resources from version control.</li>
    <li>Any resource marked as <i>derived</i> will be automatically ignored for version management by Team VCS. Some
    builders, such as the Java builder, mark all of its build output (e.g. .class files) as derived.</li>
    <li>Git supports the creation of a special <i>.gitignore</i> file whose contents describe which files or folders to
    ignore for version management. The .gitignore file only applies the pattern to resources in the <i>same</i>
    directory as the .gitignore file itself.</li>
  </ol>
  <p><em>Tip</em>: Once a resource is under version control, it cannot be subsequently ignored easily. This is why you
  must invoke an explicit command to add resources to version control.</p>
  <h3 class="related">Related Tasks</h3><a href="tasks-100d1.htm">Creating a global ignore pattern</a><br>
  <a href="tasks-114.htm">Committing</a><br>
</body>
</html>
